package april.example.file_transfer_udp;

import java.io.BufferedOutputStream;
import java.io.DataOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

public class SocketServer {
	DatagramSocket server;
	InetAddress address;
	int port;

	byte[] data = new byte[1024];

	public void receive() {
		if (server == null) {
			return;
		}
		while (true) {

			try {
				DatagramPacket packet = new DatagramPacket(data, data.length);
				server.receive(packet);

				// address = packet.getAddress();
				// port = packet.getPort();

				DataOutputStream dos = new DataOutputStream(
						new BufferedOutputStream(new FileOutputStream("test")));
				int length = 0;
//				while (packet.getLength()) {
//
//				}

			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

		}

	}

}
